Skip to content

EHN accept one-vs-all encoding for labels #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 20, 2018

Conversation

glemaitre
Copy link
Member

This PR allows user to provide targets which are one-vs-all encoded.
This is widely used in Keras for the loss function.

This is part of #409

@glemaitre
Copy link
Member Author

@massich @mrastgoo @chkoar This is to support one-vs-all encoding targets.
This is motivated by the fact that in keras a user will one-hot-encode the target to provide it to the loss function. In #409, we will greatly benefit to manage automatically this case by converting the problem to multiclass to make the under-/over-sampling before to convert it back.

It is ready for review or at least some comment regarding the internal changes.

@codecov
Copy link

codecov bot commented Mar 1, 2018

Codecov Report

Merging #410 into master will decrease coverage by <.01%.
The diff coverage is 98.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #410      +/-   ##
==========================================
- Coverage   98.78%   98.77%   -0.01%     
==========================================
  Files          68       68              
  Lines        3961     4014      +53     
==========================================
+ Hits         3913     3965      +52     
- Misses         48       49       +1
Impacted Files Coverage Δ
imblearn/utils/validation.py 100% <100%> (ø) ⬆️
imblearn/combine/smote_enn.py 100% <100%> (ø) ⬆️
imblearn/combine/smote_tomek.py 100% <100%> (ø) ⬆️
imblearn/utils/estimator_checks.py 96.21% <100%> (+0.38%) ⬆️
imblearn/utils/tests/test_validation.py 100% <100%> (ø) ⬆️
imblearn/ensemble/balance_cascade.py 100% <100%> (ø) ⬆️
imblearn/ensemble/base.py 95.45% <94.73%> (-4.55%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23ad602...dae94b9. Read the comment docs.

Returns
-------
X_resampled : {ndarray, sparse matrix}, shape \
(n_subset, n_samples_new, n_features)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indenting

@massich
Copy link
Contributor

massich commented Mar 19, 2018

LGTM

@glemaitre
Copy link
Member Author

glemaitre commented Mar 19, 2018 via email

@@ -13,6 +13,9 @@
exceptions
Module including custom warnings and error clases used across
imbalanced-learn.
keras
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be there

@glemaitre glemaitre merged commit 24f4973 into scikit-learn-contrib:master Mar 20, 2018
glemaitre added a commit that referenced this pull request Aug 22, 2018
This PR attend to provide some utilities for keras:

- [x] support for one-vs-all encoded targets (#410)
- [x] balanced batch generator

TODO:

- [x] Add common test to check multiclass == multilabel-indicator (#410)
- [x] Manage the specificity of the EasyEnsemble and BalanceCascade (overwrite `sample`)
- [x] Add user guide documentation
- [x] Add an example for simple use
- [x] Add an example for deep training
- [x] Add substitution 
- [x] What's new
- [x] Optional depencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants